<%@ page contentType="text/html; charset=UTF-8" language="java"%>
<%@ include file="/commons/pages/taglibs.jsp"%>
<%@page import="com.bjtech.dao.*,com.bjtech.web.util.*,com.bjtech.domain.*,java.util.List,com.bjtech.domain.query.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<%
	BaseBuildingInfoDao dao = (BaseBuildingInfoDao) InitServletContextListener.getBean("baseBuildingInfoDao");
	List buildList = dao.selectEntityList(new BaseBuildingInfo(),new BaseBuildingInfoQuerySpec());
	request.setAttribute("buildList",buildList);
%>
<body>
<div class="subtitle">
  <h3>用户用热对比</h3>
</div>
<input type="hidden" name="selectBean.isAll" value="0" id="sb_isall"/>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="subtbl">
  <tr>
  <td>项目所属城市：
      	 <select id="prov_index" type="text" dataType="Require" msg="请选择" onChange="initCity(this.value, 'city_index');"></select>
      <select id="city_index" name="selectBean.p_index" dataType="Require" msg="请选择" onchange="initProj(this.value)"></select>
   <font color="red">*</font>项目：
      <select name="proj_id" id="i_porj_id" onchange="initBuild(this.value)">
      </select>
      </td>
      </tr>
      <tr>
      <td>
    <font color="red">*</font>楼栋：
      <select name="build_id" id="i_build_id">
        <option value="">--==请选择==--</option>
      </select></td>
    <td><font color="red">*</font>年度：
        从
    	<select name="s_year" id="i_s_year" onchange="selectEndYear(this.value)">
    		<option value="">--==请选择==--</option>
    		<%
    		for(int i=0;i<20;i++){
    		%>
    			<option value="<%=i+2010%>"><%=i+2010%>年</option>
    		<%
    		}
    		%>
    	</select>
     至
    	<input type="text" name="e_year" id="i_e_year" readonly="readonly" size="4"/>年
    </td>
  </tr>
  <tr>
    <td><input type="button" class="websub" onclick="doQuery()" value="查 询" /></td>
  </tr>
</table>
<script src='/dwr/interface/BaseDataService.js'></script>
<script src='/dwr/engine.js'></script>
<script src='/dwr/util.js'></script>
<script src='/commons/scripts/validator.js'></script> 
<script type="text/javascript">
$j(document).ready(function(){
	var city = '<s:property value="selectBean.p_index"/>';
	var prov = '';
	if(city!=''){
		prov = city.substr(0,2)+"0000";
	}
	initCity('0','prov_index',prov,'city_index',city);
	
});
function doQuery(){
	var i_build_id = $j("#i_build_id").val();
	var i_s_year = $j("#i_s_year").val();
	var i_e_year = $j("#i_e_year").val();
	if(!i_build_id){
		alert("请选择楼栋");
		return;
	}
	if(!i_s_year){
		alert("请选择起始年度");
		return;
	}
	//document.frames["reportResult"].src=url;
	var url="report_2_result.jsp?i_build_id="+i_build_id+"&i_s_year="+i_s_year+"&i_e_year="+i_e_year;
	location.href=url;
}

function selectEndYear(s_year){
	if(s_year){
		$j("#i_e_year").val(parseInt(s_year)+1);
	}
}

function initProj(p_index){
	var buildObj = document.getElementById("i_porj_id");
	DWRUtil.removeAllOptions(buildObj);
	BaseDataService.selectProjListByPIndex(p_index,function(BaseData){
		DWRUtil.addOptions(buildObj, {'':'请选择'});
		DWRUtil.addOptions(buildObj, BaseData, "id", "proj_name");
	});
}

function initBuild(proj_id){
	var buildObj = document.getElementById("i_build_id");
	DWRUtil.removeAllOptions(buildObj);
	BaseDataService.selectBulidingListByPIndexForReport(proj_id,function(BaseData){
		DWRUtil.addOptions(buildObj, {'':'请选择'});
		DWRUtil.addOptions(buildObj, BaseData, "id", "b_name");
	});
}
</script>
</body>
</html>
